#! /usr/bin/python

import math
import time

ttime = time.time()

def generatePrimes(n):
    sieve = range(n)
    for i in range(2, int(math.sqrt(n)+1)):
	for j in range(i**2, n, i):	
	    sieve[j] = 0
    return [p for p in sieve if p != 0]

pri = generatePrimes(10**6)

pro = 1
pri2 = []
for p in pri:
    if pow(10, 10**9, p) == 1: 
	pri2.append(p)
	if len(pri2) == 41: break

print len(pri2)
print sum(pri2) - 3
